/*
 * Ant Group
 * Copyright (c) 2004-2024 All Rights Reserved.
 */
package com.alipay.zmdepositdemo.controller;

import com.alipay.zmdepositdemo.model.OpenResponse;
import com.alipay.zmdepositdemo.service.manage.DepositOrderManageService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 取消免押订单
 *
 * @author zhangjian
 * @version DepositOrderCancelController.java, v 0.1 2024年07月04日 14:25 zhangjian
 */
@Api(tags = "取消免押订单")
@ApiSupport(order = 3)
@RestController
@RequestMapping(value = "/cancel-deposit-order")
public class DepositOrderCancelController {

    @Autowired
    private DepositOrderManageService depositOrderManageService;

    /**
     * 取消免押订单
     *
     * @see <a href="https://opendocs.alipay.com/open/30ccb45e_alipay.fund.auth.operation.cancel?scene=common&pathHash=4a2a966d">...</a>
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "取消免押订单接口")
    @GetMapping(value = "/cancel")
    public OpenResponse<Boolean> cancelOrder(
            @ApiParam(value = "商户对本次撤销操作的附言描述", defaultValue = "授权撤销") @RequestParam(required = true) String remark,
            // 支付宝授权资金订单号，与商户的授权资金订单号不能同时为空，二者都传入时，以支付宝资金授权订单号为准，该参数与支付宝授权资金操作流水号配对使用。
            @ApiParam(value = "支付宝授权资金订单号", defaultValue = "2014070800002001550000014417") @RequestParam(required = false)
            String authNo,
            // 商户的授权资金订单号，与支付宝的授权资金订单号不能同时为空，二者都传入时，以支付宝的授权资金订单号为准，该参数与商户的授权资金操作流水号配对使用。
            @ApiParam(value = "商户的授权资金订单号", defaultValue = "4977164666634053") @RequestParam(required = false) String outOrderNo,
            // 支付宝的授权资金操作流水号，与商户的授权资金操作流水号不能同时为空，二者都传入时，以支付宝的授权资金操作流水号为准，该参数与支付宝授权资金订单号配对使用。
            @ApiParam(value = "支付宝的授权资金操作流水号", defaultValue = "20161012405744018102") @RequestParam(required = false)
            String operationId,
            // 商户的授权资金操作流水号，与支付宝的授权资金操作流水号不能同时为空，二者都传入时，以支付宝的授权资金操作流水号为准，该参数与商户的授权资金订单号配对使用。该值与资金冻结时out_request_no一致
            @ApiParam(value = "商户的授权资金操作流水号", defaultValue = "2016100810000003551") @RequestParam(required = false)
            String outRequestNo) {
        return depositOrderManageService.cancelOrder(remark, authNo, outOrderNo, operationId, outRequestNo);
    }
}